import { defineStore } from "pinia";
import { reactive } from 'vue'
const useAdmin = defineStore('admin', () => {
    const defaultAdmin = { username: '', avatar: '' }
    const admin = reactive(Object.assign({}, defaultAdmin))
    const updateAdmin = option => {
        Object.assign(admin, option)
        return admin
    }
    const removeAdmin = () => {
        Object.assign(admin, defaultAdmin)
        return admin
    }
    return { admin, updateAdmin, removeAdmin }
}, {
    persist: {
        enabled: true,
        strategies: [{ key: 'admin', storage: localStorage }]
    }
})
export default useAdmin